package homework2;

import java.util.Date;
import java.util.Objects;

public class Test {
    String str = new String();
    int a;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Test test = (Test) o;
        return a == test.a && Objects.equals(str, test.str);
    }

    public static void main(String[] args) {
        Test test1 = new Test();
        Test test2 = new Test();
        System.out.println(test1.equals(null));
        /*Test test1 = new Test();
        System.out.println(test1.str);
        System.out.println(test1.a);
        if (test1 == null){
            System.out.println("空的");
        }
        test1.str = "123";
        Test test2 = new Test();
        test2.str = "123";
        System.out.println(System.identityHashCode(test1));
        System.out.println(System.identityHashCode(test2));
        System.out.println(test1);
        System.out.println(test2);*/
//        System.out.println(test1.equals(test2));



        /*int a = 10;
        int b = 10;
        System.out.println(a == b);//true*/

        /*String str1 = "abc";
        String str2 = "abc";
        System.out.println(System.identityHashCode(str1));
        System.out.println(System.identityHashCode(str2));*/

        /*String str1 = new String("abc");
        String str2 = new String("abc");

        System.out.println(str1 == str2);
        System.out.println(str1.equals(str2));*/

        /*int a = 10;
        Integer integer = 10;
        System.out.println(a == integer);
        System.out.println(integer.equals(a));*/

        /*Test test1 = new Test();
        Test test2 = new Test();
        System.out.println(test1==test2);
        System.out.println(test2.equals(test1));*/

        /*Test test = new Test();
        System.out.println(test);*/

       /* Date date = new Date();
        System.out.println(date);*/

        /*Object ob = new Object();
        System.out.println(ob.hashCode());
        System.out.println(Integer.toHexString(ob.hashCode()));
        System.out.println(ob.toString());*/
    }

   /* @Override
    public String toString() {
        return "ok";
    }*/
}
